/*
 * Copyright user2010
 * All rights reserved
 */

package org.myorg.applitest.gui.swing.components.frame;

import org.myorg.applitest.gui.swing.components.button.BtnCmdApply;
import org.myorg.applitest.gui.swing.components.button.BtnCmdCancel;
import org.myorg.applitest.gui.swing.components.button.BtnCmdOk;
import org.myorg.applitest.gui.swing.components.dialog.DlgBoxError;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author user
 */
public abstract class FrmNewItmRegUsrAbs extends FrmNewItmAbs implements ActionListener{

    public FrmNewItmRegUsrAbs() throws Exception
    {
        this.lst_ = (ActionListener) this;
        
        this.setSize(800, 460);
        

    }
        protected void _close_(){
        this.dispose();
    }


    abstract protected boolean _doJob() throws Exception;


    public void actionPerformed(ActionEvent e){
        if(e.getSource() instanceof BtnCmdApply){
                try {
                    _doJob();
                }
                catch (Exception ex) {
                    ex.printStackTrace();
                    DlgBoxError dlg = new DlgBoxError(ex.getMessage());
                }
            }
            else if (e.getSource() instanceof BtnCmdOk){
                try {
                    if(_doJob()) {
                        _close_();
                    }
                }
                catch (Exception ex) {
                    ex.printStackTrace();
                    DlgBoxError dlg = new DlgBoxError(ex.getMessage());
                }
            }
            else if (e.getSource() instanceof BtnCmdCancel) {
               _close_();
            }
    }

    
    


    protected ActionListener lst_=null;

}



